<?php
namespace Users\Model;

use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;
use Zend\Db\Sql;
use Zend\Db\Sql\Where;
use Zend\Db\Sql\Select;
use Zend\Paginator\Adapter\DbSelect;
use Zend\Paginator\Paginator;
use Zend\Db\Sql\Predicate;
use Zend\Db\Sql\Expression;

class PaymentsTable
{
    protected $tableGateway;
	protected $select;
	protected $resultSet;
	
	public function __construct(TableGateway $tableGateway)
    {
        $this->tableGateway = $tableGateway;
		$this->select = new Select();
    }
	public function addPaypal($pay)
    {	
		$data=array(
	 			 'account'			=>	$pay['account'],
				 'txnid'			=>	$pay['txnid'],
			     'payment_amount'	=>	$pay['payment_amount'],
				 'payment_status'	=>	$pay['payment_status'],
				 'itemid'			=>	$pay['itemid']
			);				
		$row=$this->tableGateway->insert($data);
		return $row;
    }
	public function getTxid($data)
    {
		$select = $this->tableGateway->getSql()->select()
			->where('txnid="'.$data.'"');
		$resultSet = $this->tableGateway->selectWith($select);
		$row = $resultSet->current();
		return $row;
	}
	public function addTxid($data)
    {
		$data=array(
				'account'			=>	$data['item_number'],
				'txnid'				=>	$data['txn_id'],
				'payment_amount'	=>	$data['mc_gross'],
				'payment_status'	=>	$data['payment_status'],
				'itemid'			=>	$data['item_name']
		);				
		$row=$this->tableGateway->insert($data);
		return $row;
	}
}


